import { createSlice } from "@reduxjs/toolkit";

const defaultNav = { navId: 'home',};

const navSlice = createSlice({
    name: 'nav',
    initialState: defaultNav,
    reducers: {
        initNav(state, { payload }) {
            return payload ?? defaultNav;
        },
        setNav(state, { payload }) {
            state.navId = payload.navId;
        }
    }
});

export const { initNav, setNav } = navSlice.actions;
export default navSlice;